package com.aaa.hospital.service.impl;

import com.aaa.hospital.mapper.ShiftMapper;
import com.aaa.hospital.pojo.domain.DoctorShiftS;
import com.aaa.hospital.pojo.domain.ShiftDoctorC;
import com.aaa.hospital.pojo.query.DoctorShiftQuery;
import com.aaa.hospital.result.AjaxResult;
import com.aaa.hospital.service.ShiftService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * @author ZQ on 2022/2/15
 */
@Service
public class ShiftServiceImpl implements ShiftService {

    @Autowired
    private ShiftMapper shiftMapper;

//    @Override
//    public AjaxResult DoctorsName() {
//        List<UpShift> doctorShiftS = shiftMapper.DoctorName();
//        System.out.println(doctorShiftS);
//        return AjaxResult.success(doctorShiftS);
//    }

    @Override
    public AjaxResult aDoctor(Integer id) {
        DoctorShiftS s = shiftMapper.aDoctor(id);

        return AjaxResult.success(s);
    }

    @Override
    public AjaxResult addShift(DoctorShiftS doctorShiftS) {
        int i = shiftMapper.addShift(doctorShiftS);
        return AjaxResult.success(i);
    }

    @Override
    public AjaxResult shiftQuery(DoctorShiftQuery doctorShiftQuery) {

        List<ShiftDoctorC> shifts = shiftMapper.shiftQuery(doctorShiftQuery);
        long i = shiftMapper.queryDoctorsShiftTotal(doctorShiftQuery);
        HashMap<Object,Object> map = new HashMap<>();
        map.put("shiftCurrentData",shifts);
        map.put("shiftTotalCount",i);
        return AjaxResult.success(map);
    }


}
